package com.gylang.print.richtext;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 坐标
 *
 * @author gylang
 * data 2021/7/14
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Coords {

	private float x;

	private float y;

	private float width;

	private float height;

	public static Coords of(float x, float y) {
		return new Coords(x, y, 0, 0);
	}

	public static Coords of(float x, float y, float width, float height) {
		return new Coords(x, y, width, height);
	}

	public float sx() {
		return x;
	}

	public float ex() {
		return x + width;
	}

	public float ey() {
		return y - height;
	}

	public float sy() {
		return y;
	}
}
